/***********************************************************************
    filename:   FalStatic.cpp
    created:    Sat Sep 17 2005
    author:     Tomas Lindquist Olsen (based on code by Paul D Turner)
*************************************************************************/

#include "renderers/StaticRenderer.h"

const String StaticRenderer::TypeName = "Renderers/Static";

RendererProperties::BackgroundEnabled     StaticRenderer::d_backgroundEnabledProperty;

StaticRenderer::StaticRenderer(const String& type) :
    WindowRenderer(type),
    d_backgroundEnabled(false)
{
    registerProperty(&d_backgroundEnabledProperty);
}

void StaticRenderer::setBackgroundEnabled(bool setting)
{
    if (d_backgroundEnabled != setting)
    {
        d_backgroundEnabled = setting;
        d_window->invalidate();
    }
}

void StaticRenderer::render()
{
	bool is_enabled = !d_window->isDisabled();
    // render background section
    if (d_backgroundEnabled)
    {
        const ImagerySection& imagery = d_window->getImagerySection(is_enabled ? "EnabledBackground" : "DisabledBackground");
		// peform the rendering operation.
        imagery.render(*d_window);
    }

	const ImagerySection& imagery = d_window->getImagerySection(is_enabled ? "Enabled" : "Disabled");
	// peform the rendering operation.
	imagery.render(*d_window);
}

